package com.boot.security.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.boot.persistence.controller.ControllerImpl;
import com.boot.security.model.po.Access;
import com.boot.security.service.database.AccessService;
import com.boot.web.http.HttpModel;
import com.boot.web.util.HttpResponseUtil;
import io.swagger.annotations.Api;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Validator;
import java.util.List;

/**
 * @author 霜寒 <1621856595@qq.com>
 * @date 2020/04/02 20:25
 **/

@RestController
@RequestMapping("/access")
@Api("权限接口")
public class AccessController extends ControllerImpl<Long, Access, AccessService> {

    public AccessController(AccessService service, Validator validator) {
        super(service, validator);
    }

    @PostMapping("/list/code")
    public ResponseEntity<HttpModel<List<Access>>> selectByCodes(@RequestBody List<String> codes) {
        return HttpResponseUtil.OK("查询成功", service.list(Wrappers.<Access>lambdaQuery().in(Access::getCode, codes)));
    }

}
